<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>约教</title>
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <link rel="stylesheet" href="arrange_teaching.css">
        <link rel="stylesheet" href="normalize.css">
        <link rel="stylesheet" href="../public_css/public_header.css">
        <script src="../public/mui.min.js"></script>
    </head>
    <body>
        <header class=" public_header">

            <div class="public_header_return">
                <img src="../public_img/return.png" alt="" class="public_header_return" onclick="history.back(-1)">
                <p>约教教练</p>
            </div>
        </header>
        <section id="module">
            <ul class="main_message_moudule">

            </ul>
        </section>
        <script src="../jquery.min.js"></script>
        <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=HZE4scXysMPZY1HMDTkI4cYSjRo13zZG"></script>
        <script src="picturefill.js"></script>
        <script src="../layer.js"></script>
        <!--<script>
mui.init({
subpages:[{
url:pullrefresh-subpage-url,//下拉刷新内容页面地址
id:pullrefresh-subpage-id,//内容页面标志
styles:{
top:subpage-top-position,//内容页面顶部位置,需根据实际页面布局计算，若使用标准mui导航，顶部默认为48px；
//其它参数定义
}
}]
});
</script>-->
        <script>
            function goback(){
                history.back();
            }
            $(function () {
                var geolocation = new BMap.Geolocation();
                geolocation.getCurrentPosition(function(r){
                    var gps_w=r.point.lat;
                    var gps_j=r.point.lng;
                    console.log(gps_j);
                    console.log(gps_w);
                    var token = localStorage.phone;
                    $.ajax({
                        url:"https://newapp.icandrive.cn/api/teacherInfo.php",
                        type:'post',
                        data:{token:token,gps_w:gps_w,gps_j:gps_j},
                        dataType:'json',
                        success:function(data){
                            if(data.status==200){
                                $(data.data).each(function () {

                                    $('.main_message_moudule').append(
                                        '<li class="introduce_coach" i="'+this.teacher_id+'">'+
                                        '<div class="left_introduce">'+
                                        '<img src='+this.teacher_photo+' >'+
                                        '<p>车型任选</p>'+
                                        '</div>'+
                                        '<input class="T_id" type="hidden" value="'+this.teacher_id+'" />'+
                                        '<div class="right_introduce">'+
                                        '<div class="right_introduce_top">'+
                                        '<h3>'+this.teacher_name+'</h3>'+
                                        '<p class="subject2">科二:'+this.subject2_place+'/小时</p>'+
                                        '<p class="subject3">科三:'+this.subject3_place+'/小时</p>'+
                                        '</div>'+
                                        '<div class="right_introduce_middle">'+
                                        '<p>'+this.autograph+'</p>'+
                                        '</div>'+
                                        '<div class="right_introduce_down clearfix">'+
                                        /*'<p>17人已评价</p>'+
									'<p>16人已预约</p>'+*/
                                        '</div>'+
                                        '</div>'+
                                        '</li>'
                                    );

                                })
                            }
                            if(data.status==250){
                                layer.msg("请重新登录");
                                setInterval(function(){
                                    window.location.href="../login/log_in.html";
                                },2000)
                            }
                            if(data.status==400){
                                layer.msg('没找到附近教练');
                            }
                        },
                        error:function(){
                            layer.msg('系统维护中',function(){
                                history.go(0)
                            },1000);
                        }
                    });
                    $('.main_message_moudule').on('click','li', function () {
                        var id=$(this).attr('i');
                        localStorage.teacher_id=id;
                        localStorage.teacher_id=id;
                        window.location.href="../date_teacher2/teaching.html";
                    })
                })
            });

        </script>

        <script>
            document.addEventListener("plusready", function() {
                // 注册返回按键事件
                plus.key.addEventListener('backbutton', function() {
                    window.history.back();
                }, false);
                //此处false代表不退出页面，如果为true回退到上一个一面
            });
        </script>
    </body>
</html>
